<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class UserRegistrationMappings extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_registration_mappings', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger("userId")->default(0)->comment("用户ID");
            $table->string("registrationId", 32)->default('')->comment("设备ID");
            $table->tinyInteger("status")->default(1)->comment("状态 0-无效 1-有效");
            $table->unsignedInteger("createdAt")->default(0)->comment("创建时间");
            $table->unsignedInteger("updatedAt")->default(0)->comment("修改时间");
            $table->index('userId');
            $table->index('registrationId');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '用户极光APP设备映射表';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_registration_mappings');
    }
}
